import request from '@/utils/request'

export function getPaper(params) { // 获取试卷列表
  return request({
    url: `/v1/test/paper`,
    method: 'get',
    params
  })
}
export function setUpPaper(data) { // 创建试卷
  return request({
    url: `/v1/test/paper`,
    method: 'post',
    data: data
  })
}
export function modifyPaper(params) { // 修改试卷
  return request({
    url: `/v1/test/paper`,
    method: 'put',
    params
  })
}
export function deletePaper(params) { // 删除试卷
  return request({
    url: `/v1/test/paper`,
    method: 'delete',
    params
  })
}

// 获取题目列表
export const getTestQuestionList = (params) => {
  return request({
    url: '/v1/test/topic',
    method: 'get',
    params
  })
}

// 创建题目
export const createTestQuestion = (data) => {
  return request({
    url: '/v1/test/topic',
    method: 'post',
    data
  })
}

// 修改题目
export const editTestQuestion = (params) => {
  return request({
    url: '/v1/test/topic',
    method: 'put',
    params
  })
}

// 删除题目
export const deleteTestQuestion = (params) => {
  return request({
    url: '/v1/test/topic',
    method: 'delete',
    params
  })
}
// 批量删除题目
export const batchDeletionTestQusetion = (params) => {
  return request({
    url: '/v1/test/topics',
    method: 'delete',
    params
  })
}

// 获取题目详情
export const getTestQuestionDetails = (id) => {
  return request({
    url: `/v1/test/topic/${id}`,
    method: 'get'
  })
}

// 修改或创建答案
export const editOrCreateAnswer = (params) => {
  return request({
    url: '/v1/test/topicContent',
    method: 'put',
    params
  })
}

// 删除答案
export const deleteAnswer = (params) => {
  return request({
    url: '/v1/test/topicContent',
    method: 'delete',
    params
  })
}

// 获取题目类型列表
export const getTestQuestionType = () => {
  return request({
    url: '/v1/test/topicType',
    method: 'get'
  })
}

export function detailsPaper(id) { // 获取试卷详情
  return request({
    url: `/v1/test/paper/${id}`,
    method: 'get'
  })
}

// 将题目从试卷中移除
export const removeSubjectFromPaper = (params) => {
  return request({
    url: '/v1/test/paperTopic',
    method: 'delete',
    params
  })
}

// 批量删除试卷题目
export const batchRemoveSubjectFromPaper = (params) => {
  return request({
    url: '/v1/test/paperTopics',
    method: 'delete',
    params
  })
}

// 添加题目值试卷
export const addSubjecttoPaper = (data) => {
  return request({
    url: '/v1/test/paperTopics',
    method: 'post',
    data
  })
}

// 修改题目类型分数
export const editSubjectScore = (params) => {
  return request({
    url: '/v1/test/TypeScore',
    method: 'PUT',
    params
  })
}

// 获取考试记录列表
export const getExamRecordList = (params) => {
  return request({
    url: '/v1/test/examination',
    method: 'get',
    params
  })
}

// 获取考试记录详情
export const getExamRecordDetails = (id, params) => {
  return request({
    url: `/v1/test/examination/${id}`,
    method: 'get',
    params
  })
}

// 获取考试记录所有题目
export const getTestExamination = (id, params) => {
  return request({
    url: `/v1/test/examination/topic?id=${id}`,
    method: 'get',
    params
  })
}

// 获取单个考试记录统计
export const getExamRecordStatistics = (params) => {
  return request({
    url: '/v1/statistics/test/paper',
    method: 'get',
    params
  })
}

// 试卷导入
export const importTestPaper = (data) => {
  return request({
    url: '/v1/test/paper/import',
    method: 'POST',
    data
  })
}

// 题目导入
export const importTopic = (data) => {
  return request({
    url: '/v1/test/paper/import/topic',
    method: 'POST',
    data
  })
}

// 导出答题卡
export const exportAnswerCard = (data) => {
  return request({
    url: '/v1/test/paper/word',
    method: 'POST',
    data
  })
}

// 导出题目
export const exportTopic = (data) => {
  return request({
    url: '/v1/test/topic/word',
    method: 'POST',
    data
  })
}

// 导入题目解析
export const analysisTopic = (data) => {
  return request({
    url: '/v1/test/paper/import/analysis',
    method: 'POST',
    data
  })
}

// 导入题目解析
export const importanAlysisPaper = (data) => {
  return request({
    url: '/v1/test/paper/analysis/import',
    method: 'POST',
    data
  })
}

// 导入试卷解析
export const analysisTest = (data) => {
  return request({
    url: '/v1/test/analysis',
    method: 'POST',
    data
  })
}

// 导入试卷解析
export const analysisTestImport = (data) => {
  return request({
    url: '/v1/test/analysis/import',
    method: 'POST',
    data
  })
}

// 获取课程的试卷和考试记录
export const getCourseExamRecordList = (params) => {
  return request({
    url: '/v1/study/course/paper/count',
    method: 'get',
    params
  })
}
